<template>
  <Index />
  <div class="container">
    <div class="content">
      <div class="ticket">
        <!-- 最佳推荐 -->
        <div class="best-recommend">
          <span>最佳推荐</span>
        </div>
        <div class="card">
          <div class="bourn">
            <span class="from">北京</span>
            <div class="air-desc">
              <img src="../../assets/img/air2.png" alt="" />
              <span class="flight">南航 CZ3210</span>
            </div>
            <span class="to">上海</span>
          </div>
          <div class="card-content">
            <span style="margin-left: 1px">2024年1月25日 22:00 ~ 00:50</span>
          </div>
          <div class="price-desc">
            <div class="left">
              <div class="price">
                <div class="num-cont">
                  <span class="dot">￥</span><span class="p-num">800</span>
                </div>
              </div>
              <div class="desc-t">
                <div class="desc">
                  <div class="desc-content">
                    <div class="left">
                      <span>AI帮您省了</span>
                    </div>
                    <div class="right">
                      <span>100元</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="num-cont">
              <span class="num">x 2</span>
            </div>
          </div>
          <div class="dotted-line"></div>
          <div class="bottom">
            <div class="user">
              <div class="info">
                <img class="userimg" src="../../assets/img/add.png" alt="" />
                <span>添加人</span>
              </div>
              <div class="info">
                <img class="userimg" src="../../assets/img/user.png" alt="" />
                <span>张德华</span>
              </div>
              <div class="info">
                <img class="userimg" src="../../assets/img/user.png" alt="" />
                <span>张华</span>
              </div>
              <div class="info">
                <img class="userimg" src="../../assets/img/user.png" alt="" />
                <span>张箐</span>
              </div>
            </div>

            <img class="airplane" src="../../assets/img/airbg.png" alt="" />
          </div>
        </div>
      </div>
      <div class="payment">
        <div class="payment-container">
          <div class="pay-method">
            <span class="title">支付方式:</span>
            <div class="pay-method-cont">
              <div
                class="pay-item"
                :class="{ active: payType == index }"
                v-for="(item, index) in payments"
                :key="index"
                @click="checkPay(index)"
              >
                <img
                  class="check"
                  v-if="payType == index"
                  :src="item.checkimg"
                  alt=""
                />
                <img :src="item.icon" alt="" />
              </div>
            </div>
          </div>
          <div class="total-num">
            <span class="num">数量:</span>
            <div class="number">
              <span class="dot">x</span><span class="ns">2</span>
            </div>
          </div>
          <div class="total-price">
            <span class="price-title">支付总金额:</span>
            <div class="price-num">
              <span>¥</span>
              <span>1604</span>
            </div>
          </div>

          <div class="submit-btn" @click="submitPay">
            <span>立即支付</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, reactive } from "vue";
import wx from "../../assets/img/wx.png";
import zfb from "../../assets/img/zfb.png";
import yinl from "../../assets/img/yinl.png";
import check from "../../assets/img/check.png";
import { useRouter } from "vue-router";


let payType = ref(0);

let router=useRouter()
let payments = reactive([
  {
    name: "微信",
    icon: wx,
    checkimg: check,
  },
  {
    name: "支付宝",
    icon: zfb,
    checkimg: check,
  },
  {
    name: "银联",
    icon: yinl,
    checkimg: check,
  },
]);
function checkPay(index) {
  payType.value = index;
}

function submitPay(){
  router.push("/order_sucss")
}
</script>
<style scoped lang="scss">
.container {
  width: 80vw;
  height: 70vh;
  position: absolute;
  top: 50%;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  .content {
    width: 100%;
    display: flex;
    margin-top: 5%;
    align-items: center;
    justify-content: center;
    .ticket {
      width: 656px;
      height: 312px;
      background: #ffffff;
      box-shadow: 0px 4px 10px 0px rgba(171, 181, 191, 0.2);
      border-radius: 14px;
      position: relative;
      .best-recommend {
        width: 76px;
        height: 30px;
        background: #dbf5e0;
        border-radius: 0px 12px 0px 8px;
        position: absolute;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        span {
          font-family: PingFangSC, PingFang SC;
          font-weight: bold;
          font-size: 14px;
          color: #35c74f;
          line-height: 14px;
          text-align: center;
          font-style: normal;
        }
      }

      .card {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        .bourn {
          display: flex;
          align-items: center;
          .from {
            font-family: PingFangSC, PingFang SC;
            font-weight: 600;
            font-size: 35px;
            color: #000000;
            line-height: 35px;
            text-align: left;
            font-style: normal;
          }
          .to {
            font-family: PingFangSC, PingFang SC;
            font-weight: 600;
            font-size: 35px;
            color: #000000;
            line-height: 35px;
            text-align: left;
            font-style: normal;
          }

          .air-desc {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin: 0 10px;
            img {
              width: 20px;
              height: 20px;
            }
            .flight {
              // width: 83px;
              // height: 14px;
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              font-size: 13px;
              color: #6f6f6f;
              line-height: 14px;
              text-align: center;
              font-style: normal;
              margin-top: 2px;
            }
          }
          img {
            width: 25px;
            height: 22px;
            margin: 0 4px;
          }
        }

        .card-content {
          display: flex;
          align-items: center;
          margin-top: 15px;
          span {
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 14px;
            color: #6f6f6f;
            line-height: 14px;
            text-align: left;
            font-style: normal;
          }
        }

        .price-desc {
          display: flex;
          align-items: center;
          margin-top: 18px;
          width: 100%;
          justify-content: space-between;
          .num-cont {
            .num {
              font-family: PingFangSC, PingFang SC;
              font-weight: 600;
              font-size: 18px;
              color: #000000;
              line-height: 14px;
              text-align: right;
              font-style: normal;
            }
          }

          .left {
            display: flex;

            .price {
              .num-cont {
                display: flex;
                align-items: flex-end;
                .dot {
                  font-family: PingFangSC, PingFang SC;
                  font-weight: 600;
                  font-size: 24px;
                  color: #f23232;
                  line-height: 53px;
                  text-align: left;
                  font-style: normal;
                  position: absolute;
                  top: 108px;
                  left: 16px;
                }
                .p-num {
                  // width: 142px;
                  height: 53px;
                  font-family: PingFangSC, PingFang SC;
                  font-weight: 600;
                  font-size: 46px;
                  color: #f23232;
                  // line-height: 53px;
                  text-align: left;
                  font-style: normal;
                  margin-left: 20px;
                }
              }
            }
            .desc-t {
              display: flex;
              align-items: flex-end;
              margin-left: 10px;
              .desc {
                width: 107px;
                height: 21px;
                border-radius: 3px;
                border: 1px solid #f23232;
                // margin-left: 10px;

                .desc-content {
                  display: flex;
                  align-items: center;

                  .right {
                    width: 55px;
                    height: 21px;
                    background: #f23232;
                    border-radius: 3px;
                    display: flex;
                    align-items: center;
                    justify-content: center;

                    span {
                      font-family: PingFangSC, PingFang SC;
                      font-weight: 400;
                      font-size: 14px;
                      color: #ffffff;
                      line-height: 11px;
                      text-align: left;
                      font-style: normal;
                      // width: 55px;
                    }
                  }
                  .left {
                    height: 21px;
                    background: rgba(242, 50, 50, 0.08);
                    border-radius: 3px;
                    //   border: 1px solid #f23232;
                    display: flex;
                    align-items: center;
                    justify-content: center;

                    span {
                      font-family: PingFangSC, PingFang SC;
                      font-weight: 400;
                      font-size: 11px;
                      color: #f23232;
                      line-height: 11px;
                      text-align: left;
                      font-style: normal;
                      width: 57px;
                      margin-left: 3px;
                    }
                  }
                }
              }
            }
          }
        }

        .dotted-line {
          width: 100%;
          border: 1px dashed #cfcfcf;
          margin-top: 22px;
        }
        .bottom {
          display: flex;
          .user {
            position: absolute;
            display: flex;
            align-items: center;
            left: 10px;
            bottom: 15%;
            height: 60px;
            .info {
              display: flex;
              flex-direction: column;
              align-items: center;
              justify-content: flex-start;
              width: 40px;
              margin-left: 10px;

              .userimg {
                width: 40px;
                height: 40px;
              }
              span {
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 13px;
                color: #000000;
                line-height: 13px;
                text-align: left;
                font-style: normal;
                margin-top: 5px;
              }
            }
          }
          .airplane {
            width: 80%;
            margin-left: 64px;
            margin-top: 1px;
          }
        }
      }
    }
    .payment {
      width: 411px;
      height: 312px;
      background: #ffffff;
      box-shadow: 0px 4px 10px 0px rgba(171, 181, 191, 0.2);
      border-radius: 14px;
      margin-left: 15px;
      position: relative;

      .payment-container {
        padding: 20px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        .pay-method {
          display: flex;
          align-items: center;
          justify-content: space-between;

          .pay-method-cont {
            display: flex;
            width: 200px;
            justify-content: space-around;
            .pay-item {
              width: 51px; /* 设置宽度 */
              height: 51px; /* 设置高度，保持与宽度一致 */
              border-radius: 50%; /* 将边框半径设为50%，这样四个角都会是半径相等的圆弧，形成完整的圆形 */
              background: #ffffff;
              box-shadow: 0px 2px 5px 0px rgba(205, 207, 210, 0.27);
              display: flex;
              align-items: center;
              justify-content: center;
              position: relative;

              img {
                width: 38px;
                height: 38px;
                cursor: pointer;
              }
              .check {
                width: 15px;
                height: 15px;
                position: absolute;
                top: 4px;
                left: 41px;
                z-index: 100;
              }
            }
          }

          .title {
            width: 100px;
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 16px;
            color: #6c6c6c;
            line-height: 16px;
            text-align: left;
            font-style: normal;
          }
        }

        .total-price {
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin-top: 20px;

          .price-title {
            width: 100px;
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 16px;
            color: #6c6c6c;
            line-height: 16px;
            text-align: left;
            font-style: normal;
          }
          .price-num {
            font-family: PingFangSC, PingFang SC;
            font-weight: 600;
            color: #f23232;
            line-height: 26px;
            text-align: left;
            font-style: normal;
            font-size: 18px;
            span {
              font-size: 18px;
            }
            span ~ span {
              margin-left: 6px;
              font-size: 30px;
            }
          }
        }

        .total-num {
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin-top: 20px;

          .num {
            width: 100px;
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 16px;
            color: #6c6c6c;
            line-height: 16px;
            text-align: left;
            font-style: normal;
          }
          .number {
            .dot {
              font-family: PingFangSC, PingFang SC;
              font-weight: 600;
              font-size: 20px;
              color: #000000;
              text-align: left;
              font-style: normal;
            }
            .ns {
              font-family: PingFangSC, PingFang SC;
              font-weight: 600;
              font-size: 20px;
              color: #000000;
              text-align: left;
              font-style: normal;
              margin-left: 10px;
            }
          }
        }

        .submit-btn {
          width: 169px;
          height: 53px;
          background: #005ff9;
          border-radius: 26px;
          margin-top: 39px;
          display: flex;
          justify-content: center;
          align-items: center;
          cursor: pointer;
          & > :nth-child(1) {
            font-family: PingFangSC, PingFang SC;
            font-weight: 500;
            font-size: 18px;
            color: #ffffff;
            // line-height: 18px;
            text-align: center;
            font-style: normal;
          }
          &:hover {
            background: #005ff9;
            transform: translateY(-2px);
            box-shadow: 0px 4px 10px 0px rgba(171, 181, 191, 0.2);
            span {
              color: #ffffff;
            }
          }
        }
      }
    }
  }
}
.active {
  border: 1px solid #005ff9;
}
</style>
